package com.oromwin.repos.server.response;

import java.io.DataOutputStream;
import java.io.IOException;

import org.apache.commons.logging.Log;

import com.oromwin.repos.common.Logger;
import com.oromwin.repos.common.ReposException;
import com.oromwin.repos.common.helper.IOHelper;

public class CreateResponse extends NormalResponse {
    private Log log = Logger.getLog(CreateResponse.class);
    private String ObjectId = null;
    
    public CreateResponse(boolean result, String description, String objectId) {
        Result = result;
        Description = description;
        ObjectId = objectId;
    }

    @Override
    public void send(DataOutputStream dos) throws ReposException {
        try {
            dos.writeBoolean(Result);
            IOHelper.writeUTF8(dos, Description.toString());
            IOHelper.writeUTF8(dos, ObjectId.toString());
        } catch (IOException e) {
            throw ReposException.create(log, e);
        }
    }
    
    public String getObjectId() {
        return ObjectId;
    }
}
